<template>
  <div>
    <el-table :data="arr" style="width: 100%" height="700">
      <el-table-column prop="id" label="序号" > </el-table-column>
      <el-table-column prop="card" label="卡号" > </el-table-column>
      <el-table-column prop="level" label="会员等级" >
        <template slot-scope="scope">
          <span style="color: #ffc71c">{{ scope.row.level }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="会员姓名" >
      </el-table-column>
      <el-table-column prop="phone" label="手机号码" width="180">
      </el-table-column>
      <el-table-column prop="consumption" label="累计消费(元)" >
      </el-table-column>
      <el-table-column prop="balance" label="储存余额(元)" >
      </el-table-column>
      <el-table-column prop="stockpile" label="累计储值">
      </el-table-column>
      <el-table-column prop="integral" label="积分" >
      </el-table-column>
      <el-table-column prop="date" label="开卡时间" width="200">
      </el-table-column>
      <el-table-column prop="time" label="到期时间"  width="200">
      </el-table-column>
      <el-table-column prop="state" label="会员状态">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.state"
            active-color="#13ce66"
            inactive-color="#ff4949"
          >
          </el-switch>
        </template>
      </el-table-column>
        <el-table-column prop="state" label="操作" >
        <template slot-scope="scope">
          <span style="color: #c2c5f6;cursor:pointer" @click="handleoption(scope.row.id)">删除</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {deletApi} from '../../../api/homeApi'
export default {
 props:['arr'],
 data() {
    return {

        value:false,
      // tableData: [
      //   {
      //     id: 1,
      //     card: "028100159",
      //     type: "普通会员",
      //     level: "VIP1",
      //     name: "王小虎",
      //     phone: "17754138769",
      //     consumption: "1200.90",
      //     balance: "1200.90",
      //     stockpile: "1200.90",
      //     integral: "1000",
      //     date: "2016-05-02",
      //     time: "2019-05-02",
      //     state:true
      //   },
      //   {
      //     id: 1,
      //     card: "028100159",
      //     type: "普通会员",
      //     level: "VIP1",
      //     name: "王小虎",
      //     phone: "17754138769",
      //     consumption: "1200.90",
      //     balance: "1200.90",
      //     stockpile: "1200.90",
      //     integral: "1000",
      //     date: "2016-05-02",
      //     time: "2019-05-02",
      //     state:true
      //   },
      // ],
    };
  },
  methods:{
    handleoption(id){
      deletApi({id:id}).then(res=>{
        console.log('res',res);
        if(res.code == 200){
          this.$emit('rest')
        }
      })
        
      
     
    } 
  }
};
</script>

<style lang="less" scoped>
/deep/.el-table th.el-table__cell{
  background: #c2c5f6;
  
  height: 60px;
  line-height: 60px;
  text-align: center;
}
/deep/.el-table .el-table__cell {
  text-align: center;
}
</style>